home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-28 | 5.7 KB | 235 lines | [TEXT/MPS ] |
- {*-------------------------------------------------------------------------------*
- | |
- | <<< Pascal Library Interface >>> |
- | |
- | Copyright Apple Computer, Inc. 1986 |
- | All rights reserved. |
- | |
- *-------------------------------------------------------------------------------*}
-
- {
- Interface to the Pascal I/O and Memory Manager Library.
- Built-in procedure and function declarations are marked with
- the (* *) comment characters
- }
-
- UNIT PASLIBIntf;
-
- INTERFACE
-
- TYPE
- PASCALPOINTER = ^INTEGER; { Universal POINTER type }
- PASCALFILE = FILE; { Universal FILE type }
- (*
- * PASCALBLOCK = { Universal block of chars }
- * PACKED ARRAY [0..511] OF CHAR;
- *)
-
- CONST
- { <StdIO.h> PLSetVBuf styles }
- _IOFBF = $00; { File buffering }
- _IOLBF = $40; { Line buffering }
- _IONBF = $04; { No buffering }
-
- {
- Mac Pascal heap management
- }
-
- PROCEDURE PLHeapInit(sizepheap: LONGINT; heapDelta: LONGINT;
- memerrProc: UNIV PASCALPOINTER; allowNonCont: BOOLEAN;
- forDispose: BOOLEAN);
-
- PROCEDURE PLSetNonCont(allowNonCont: BOOLEAN);
-
- PROCEDURE PLSetMErrProc(memerrProc: UNIV PASCALPOINTER);
-
- PROCEDURE PLSetHeapType(forDispose: BOOLEAN);
-
- PROCEDURE PLSetHeapCheck(DoIt: BOOLEAN);
-
- {
- File I/O
- }
-
- (*
- * PROCEDURE
- * RESET(VAR fvar: UNIV PASCALFILE; OPT fname: STRING);
- * BUILTIN;
- *
- * PROCEDURE
- * REWRITE(VAR fvar: UNIV PASCALFILE; OPT fname: STRING);
- * BUILTIN;
- *
- * PROCEDURE
- * OPEN(VAR fvar: UNIV PASCALFILE; fname: STRING);
- * BUILTIN;
- *)
-
- PROCEDURE PLSetVBuf(VAR fvar: TEXT; buffer: UNIV PASCALPOINTER;
- style: INTEGER; bufsize: INTEGER);
- (*
- * FUNCTION
- * BLOCKREAD(
- * VAR fvar: FILE;
- * VAR buffer: UNIV PASCALBLOCK;
- * nBlocks: INTEGER;
- * OPT stBlock:INTEGER
- * ):
- * INTEGER;
- * BUILTIN;
- *
- * FUNCTION
- * BLOCKWRITE(
- * VAR fvar: FILE;
- * VAR buffer: UNIV PASCALBLOCK;
- * nBlocks: INTEGER;
- * OPT stBlock:INTEGER
- * ):
- * INTEGER;
- * BUILTIN;
- *
- * FUNCTION
- * BYTEREAD(
- * VAR fvar: FILE;
- * VAR buffer: UNIV PASCALBLOCK;
- * nBytes: LONGINT;
- * OPT stByte: LONGINT
- * ):
- * LONGINT;
- * BUILTIN;
- *
- * FUNCTION
- * BYTEWRITE(
- * VAR fvar: FILE;
- * VAR buffer: UNIV PASCALBLOCK;
- * nBytes: LONGINT;
- * OPT stByte: LONGINT
- * ):
- * LONGINT;
- * BUILTIN;
- *
- * FUNCTION
- * EOF(OPT VAR fvar: UNIV PASCALFILE):
- * BOOLEAN;
- * BUILTIN;
- *
- * FUNCTION
- * EOLN(OPT VAR fvar: TEXT):
- * BOOLEAN;
- * BUILTIN;
- *
- * PROCEDURE
- * READ(VAR fvar: TEXT; OPT EXPR_LIST);
- * BUILTIN;
- *
- * PROCEDURE
- * READLN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
- * BUILTIN;
- *
- * PROCEDURE
- * WRITE(VAR fvar: TEXT; OPT EXPR_LIST);
- * BUILTIN;
- *
- * PROCEDURE
- * WRITELN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
- * BUILTIN;
- *
- * PROCEDURE
- * GET(VAR fvar: UNIV PASCALFILE);
- * BUILTIN;
- *
- * PROCEDURE
- * PUT(VAR fvar: UNIV PASCALFILE);
- * BUILTIN;
- *
- * PROCEDURE
- * SEEK(VAR fvar: UNIV PASCALFILE; recno: LONGINT);
- * BUILTIN;
- *)
-
- FUNCTION PLFilePos(VAR fvar: UNIV PASCALFILE): LONGINT;
-
- PROCEDURE PLFlush(VAR fvar: TEXT);
-
- PROCEDURE PLCrunch(VAR fvar: UNIV PASCALFILE);
- {
- Directory operations.
- }
-
- PROCEDURE PLPurge(fname: STRING);
-
- PROCEDURE PLRename(oldFname, newFname: STRING);
-
-
-
- FUNCTION BAND4(long1, long2: LongInt): LongInt; {these calls are only here temporarilty }
- FUNCTION BOR4 (long1, long2: LongInt): LongInt;
- FUNCTION BXOR4(long1, long2: LongInt): LongInt;
- FUNCTION BNOT4(long1: LongInt): LongInt;
-
- FUNCTION BSL4 (long1: LongInt; count: INTEGER): LongInt;
- FUNCTION BSR4 (long1: LongInt; count: INTEGER): LongInt;
- FUNCTION BRotL4(long1: LongInt; count: INTEGER): LongInt;
- FUNCTION BRotR4(long1: LongInt; count: INTEGER): LongInt;
-
- FUNCTION BTst4( long1: LongInt; pos: INTEGER): BOOLEAN;
- PROCEDURE BClr4(VAR long1: LongInt; pos: INTEGER);
- PROCEDURE BSet4(VAR long1: LongInt; pos: INTEGER);
-
- (* JAM 91.08.18 *)
- (* The following INLINE byte-level routines emit code that
- accesses only the specified byte, and no adjacent bytes
- on either side. This is an absolute requirement for
- manipulating softswitches on the Apple IIGS. "Normal"
- code emitted by the Pascal code generator tends to
- access nothing smaller than a word at a time, for
- efficiency's sake, packing and unpacking individual bytes
- as necessary. But sometimes, the somewhat larger, slower
- code here is preferrable, because, especially in
- softswitch manipulation, mere access to bytes other than
- the one you want can leave the machine in bizarre states.
- *)
- FUNCTION Peek(AddrOfByte: LONGINT): INTEGER;
- (* Return as an INTEGER, the value of the byte at location
- given by AddrOfByte. This routine accesses the single
- byte at the given address only, by narrowing acc-mem
- width to 8-bits before the read operation.
- *)
- (* 16 bytes, 41 or 44 cycles depending on SP value at entry *)
- INLINE
- (* PHD *) $0B,
- (* TSC *) $3B,
- (* TCD *) $5B,
- (* SEP #$20 *) $E2, $20,
- (* LDA [AddrOfByte] *) $A7, $03,
- (* STA Peek *) $85, $07,
- (* STZ Peek+1 *) $64, $08,
- (* REP #$20 *) $C2, $20,
- (* PLD *) $2B,
- (* PLA *) $68,
- (* PLA *) $68
- ;
-
- PROCEDURE Poke(AddrOfByte: LONGINT; ValueToPoke: INTEGER);
- (* Put the lower byte of ValueToPoke into the RAM byte-location
- specified by AddrOfByte. This routine accesses the
- single byte at the given address only, by narrowing the
- acc-mem width to 8-bits before the write.
- *)
- (* 15 bytes, 43 or 45 cycles depending on SP value at entry *)
- INLINE
- (* PHD *) $0B,
- (* TSC *) $3B,
- (* TCD *) $5B,
- (* SEP #$20 *) $E2, $20,
- (* LDA ValueToPoke *) $A5, $03,
- (* STA [AddrOfByte] *) $87, $07,
- (* REP #$20 *) $C2, $20,
- (* PLD *) $2B,
- (* PLA *) $68,
- (* PLA *) $68,
- (* PLA *) $68
- ;
-
- END.
-